package com.zjitc.fmmal.service.impl;

import com.zjitc.fmmal.entity.User;
import com.zjitc.fmmal.service.UserService;
import com.zjitc.fmmal.vo.ResultVO;
import com.zjitc.fmmall.mapper.UserMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;


@Service
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;

    @Override
    public ResultVO checkLogin(String name, String password) {
        User user = userMapper.queryUserByName(name);
        if(user==null){
            return new ResultVO(10001,"用户不存在",null);
        }
        if(password.equals(user.getPassword())){
            return new ResultVO(10000,"登录成功",user);
        }else{
            return new ResultVO(10003,"密码错误",null);
        }

    }
}
